    package al.ui;

import java.awt.Color;
import java.awt.FlowLayout;
import java.util.Vector;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.ComboBoxModel;
import javax.swing.JPanel;

public class Form2 extends JPanel {
	private int labelWidth = 80;
	private JPanel content;
	//Les elems du forms
	Vector<Object> elem;
	static int nbrElement = 0;
	
	public Form2() {
		this(80);
		elem=new Vector<Object>();
	}
	
	public Form2(int labelWidth) {
		elem=new Vector<Object>();
		this.setLayout(new FlowLayout(FlowLayout.CENTER));
		this.setBackground(Color.WHITE);
		content = new JPanel();
		content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
		content.setBackground(Color.WHITE);
		this.labelWidth = labelWidth;
		this.add(content);
		
	}
	
	public void add(String label, String[] item) {
		LabeledTextField a=new LabeledTextField(label, item, labelWidth);
		elem.add(a);
		content.add(a);
	}
	public void add(String label, int size) {
		LabeledTextField a=new LabeledTextField(label, size, labelWidth);
		elem.add(a);
		content.add(a);	
	}
	public void add(String [] item, int s1, int s2, int s3) {
		content.add(new ComboText(item, s1, s2, s3));
		//this.setBorder(BorderFactory.createLineBorder(Color.blue));
	}
	public void add(Object [][] data, String [] titres) {
		content.add(new ComboText(data,titres ));
		//this.setBorder(BorderFactory.createLineBorder(Color.blue));
	}
		
	public void setAlignment(int align) {
		setLayout(new FlowLayout(align));
	}
}
